<template>
  <div class="container">
    <el-dialog
      title="修改学科"
      :visible="isShow"
      width="30%"
      center
      @close="btnCancle"
    >
      <el-form label-width="80px" :model="updataProps">
        <el-form-item label="学科名称">
          <el-input
            v-model="updataProps.subjectName"
            placeholder="请输入学科名称"
          />
        </el-form-item>
        <el-form-item label="是否显示">
          <el-switch
            v-model="updataProps.isFrontDisplay"
            active-color="#13ce66"
            inactive-color="#ff4949"
          >
          </el-switch>
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button @click="btnCancle">取 消</el-button>
        <el-button type="primary" @click="btnOk">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { update } from "../../api/hmmm/subjects";
export default {
  props: {
    isShow: {
      type: Boolean,
      required: true
    },
    updataProps: {
      type: Object,
      required: true
    }
  },
  data() {
    return {};
  },
  methods: {
    async btnOk() {
      try {
        await update(this.updataProps);
        this.$message.success("修改成功");
        this.$emit("update:isShow", false);
        this.$emit("list");
      } catch (err) {
        console.log(err);
      }
    },
    btnCancle() {
      this.$emit("update:isShow", false);
    }
  }
};
</script>

<style scoped lang="less"></style>
